﻿@page
@inject Remotely.Server.Services.IApplicationConfig AppConfig
@inject Remotely.Server.Services.IDataService DataService
@model RegisterModel
@{
    ViewData["Title"] = "Register";
    var organizationCount = DataService.GetOrganizationCount();
}

<h3>@ViewData["Title"]</h3>

<div class="row">
    @if (AppConfig.MaxOrganizationCount < 0 || organizationCount < AppConfig.MaxOrganizationCount)
    {
        <div class="col-md-4">
            <form asp-route-returnUrl="@Model.ReturnUrl" method="post">
                <h5>Create a new account.</h5>
                <hr />
                <div asp-validation-summary="All" class="text-danger"></div>
                <div class="form-group">
                    <label asp-for="Input.Email"></label>
                    <input asp-for="Input.Email" class="form-control" />
                    <span asp-validation-for="Input.Email" class="text-danger"></span>
                </div>
                <div class="form-group">
                    <label asp-for="Input.Password"></label>
                    <input asp-for="Input.Password" class="form-control" />
                    <span asp-validation-for="Input.Password" class="text-danger"></span>
                </div>
                <div class="form-group">
                    <label asp-for="Input.ConfirmPassword"></label>
                    <input asp-for="Input.ConfirmPassword" class="form-control" />
                    <span asp-validation-for="Input.ConfirmPassword" class="text-danger"></span>
                </div>
                <button type="submit" class="btn btn-secondary">Register</button>
            </form>
        </div>
    }
    else
    {
        <div class="col-sm-12">
            <h5>Registration is disabled.</h5>

        </div>
    }
</div>

@section Scripts {
    <partial name="_ValidationScriptsPartial" />
}
